package com.fuzongle.tankboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

import static org.springframework.boot.WebApplicationType.SERVLET;

/**
 * Spring Boot 项目启动类
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class TankBootApplication {

    private static Logger log = LoggerFactory.getLogger(TankBootApplication.class);

    public static void main(String[] args) throws UnknownHostException {

        ConfigurableApplicationContext application = new SpringApplicationBuilder(TankBootApplication.class).web(SERVLET).run(args);
        Environment env = application.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "项目运行成-功! 访问连接:\n\t" +
                        "后台地址: \t\thttp://{}:{}/doc.html\n" +
                        "----------------------------------------------------------",
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
    }



}
